/*
 * Copyright (C) 2013 TopCoder Inc., All Rights Reserved.
 */
package cn.itcast.heima;

/**
 * @author TCSASSEMBLER
 * @version 1.0 ()
 * @since 1.0
 */
public class TraditionalThreadCommunication {

	public static void main(String[] args) {
		new Thread(
				new Runnable() {
					
					@Override
					public void run() {
						
						for(int j = 0; j < 50; j++ )
						synchronized (TraditionalThreadSynchronized.class) {
							
						
					    for(int i = 0; i < 10; i++) {
					    	
					    	System.out.println("sub thread sequence of " + i + " loop: " + j);
					    }
						}
					}
				}
		).start();
		new Thread(
				new Runnable() {
					public void run() {
						for(int j = 0; j < 50; j++ )
						synchronized (TraditionalThreadSynchronized.class) {
					    for(int i = 0; i < 10; i++) {
					    	System.out.println("sub thread sequence of " + i + " loop: " + j);
					    	
					    }
						}
					}
				}
		).start();
	
		for(int j = 0; j < 50; j++ )
			synchronized (TraditionalThreadSynchronized.class) {
		    for(int i = 0; i < 10; i++) {
		    	System.out.println("main thread sequence of " + i + " loop: " + j);
		    	
		    }
			}
	
	}

}

class Bussiness {
	
	public void sub() {
		
	}
	
	public void main() {
		
	}
	
}
